<table border=0>

<?php
require_once('class/member.php');
$dir = "images";
$file_display = array ('jpg','jpeg','png','gif');

if(file_exists($dir)==false){
    echo "Invalid Directory";
}else{
    $dir_contents = scandir($dir);   
    unset($dir_contents[0]);
    unset($dir_contents[1]);
    $image = new image;
    $comment = new comment;
    
    foreach($dir_contents as $file){
        
        $ima = $dir."/".$file;
       // echo $ima;
       $picture=$image->checkImage($ima);       
        if(empty($picture)){
            $image->addImage($ima);
        }
        else{       
         
        }
       
    }
    
      if(isset($_SESSION['username'])){
        $choose=$image->choose();
        
     
        $count=count($choose);
        
        for($x=1;$x<$count;$x++){
            
         
   echo '<td align="left" width="300px"><img src="'.$choose[$x].'" width="300px">';
            
           }
         }
      }
      if(!isset($_SESSION['username'])){
        $choose=$image->choose();    
     
        $count=count($choose);
        
        for($x=1;$x<$count;$x++){
            
            echo '<td align="left" width="300px"><img src="'.$choose[$x].'" width="300px">';
            
            
            
            
           }
                 if(!isset($_SESSION['username2'])){
                $_SESSION['username2']="";
                }
         }

  
      
?>
</table>